import { http } from '@/utils/http'

export interface SpecialTrainItem {
  specialId: number
  specialName: string
  specialCode: string
  frontImage: string
  courseCount: number
  examCount: number
  compCourseCount: number
  compExamCount: number
}

/* 专题for24 */
export const getSpecialTrainList = (): Promise<IResData<SpecialTrainItem[]>> => {
  return http.get<SpecialTrainItem[]>('/api/MP/GetSpecialTrainList')
}

/* 热门专题列表 */
export const getHotSpecialTrainList = (): Promise<IResData<SpecialTrainItem[]>> => {
  return http.get<SpecialTrainItem[]>('/api/MP/GetHotSpecialTrainList')
}

export interface SpecialDetail {
  courseList: Array<{
    resId: number
    resName: string
    resType: number
    cateId: number
    cateName: string
    tags: string
    resImg: string
    resTime: string
    likeNum: number
    lookNum: number
    commentNum: number
    overTime: string
    openCrowd: string
    openCrowdOption: string
    cateImg: string
    isLike: number
    isCollect: number
    content: string
    cateContent: string
    webUrl: string
    isLook: number
    isCompele: number
    cpbProductIntroduction: string
    allowTimes: number
    testTimes: number
    timeLength: number
    optionKey: number
    products: any
    resCover: string
    cateCover: string
    startTime: string
    endTime: string | null
    cateNameEn: string
  }>
  completedCourCount: number
  examList: any[]
  completedExamCount: number
  process: string
}
/* 专题详情 */
export const getSpecialDetail = (specialId: number): Promise<IResData<SpecialDetail>> => {
  return http.get<SpecialDetail>(`/api/MP/GetSpecialDetail`, {
    specialId,
  })
}
